package com.qx.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qx.mapper.PurchaseMapper;
import com.qx.po.Purchase;
import com.qx.service.IPurchaseService;

@Service("iPurchaseService")
public class PurchaseServiceImpl implements IPurchaseService {
	
@Autowired
	private PurchaseMapper purchaseMapper; //通过@Autowired向spring容器注入EmployeesMapper
	public void setPurchaseMapper(PurchaseMapper purchaseMapper) {
		this.purchaseMapper = purchaseMapper;
	}
	@Override
	public Purchase selectPurchaseBypno(String pno) throws Exception {
		Purchase purchase = purchaseMapper.selectPurchaseBypno(pno);
        return purchase;
	}
	@Override
    //查询所有 Purchase 信息
    public List<Purchase> selectPurchaseAll() throws Exception {
    	List<Purchase> purchase = purchaseMapper.selectPurchaseAll();
        return purchase;
    }
	@Override
    //向 Purchase 表插入一条数据
    public void insertPurchase(Purchase purchase) throws Exception {
		purchaseMapper.insertPurchase(purchase);
    }
	@Override   
    //根据 pno 修改 Purchase 表数据
    public void updatePurchaseBypno(Purchase purchase) throws Exception {
		purchaseMapper.updatePurchaseBypno(purchase);
    }
	@Override   
    //根据 pno 删除 Purchase 表数据
    public void deletePurchaseBypno(String pno) throws Exception {
		purchaseMapper.deletePurchaseBypno(pno);
    }

}
